package com.xuecheng.api.client;

import com.xuecheng.api.client.fallback.SearchClientFallBackFactory;
import com.xuecheng.api.dto.CourseIndex;
import com.xuecheng.base.exception.ValidatedGroups;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: 搜索微服务客户端
 * @date 2025/2/20 16:50
 */
@FeignClient(value = "search-api", fallbackFactory = SearchClientFallBackFactory.class)
public interface SearchClient {

    /**
     * 添加课程索引
     * @param courseIndex 课程索引
     */
    @PostMapping("/search/index/course")
    Boolean save(@RequestBody CourseIndex courseIndex);

    /**
     * 更新课程索引
     * @param courseIndex 课程索引
     */
    @PutMapping("/search/index/course")
    Boolean update(@RequestBody CourseIndex courseIndex);

    /**
     * 删除课程索引
     * @param id 课程id
     */
    @DeleteMapping("/search/index/course/{id}")
    Boolean delete(@PathVariable("id") String id);
}
